const bing = require('bing-translate-api').translate;

/**
 * @param { Object.<string, string> } pkg
 * @returns { Object.<string, string> }
 */

async function translate(pkg) {
    let result = {};
    for (let k in pkg) {
        let res = await bing(pkg[k], "zh-Hans", "en", true);
        result[k] = res.translation;
    }
    return result;
}

module.exports.translate = translate;
